<route>
    {
        meta: {
            layout: 'index',
            title:'项目预览'
        }
    }  
  </route>
<template>
    <view>
        <div id="preview"></div>
        <a-row>
            <a-col :span="8">
                <view v-for="(item, index) in files" @click="downloadFile(item)">
                    <FileCell :fileId="item"></FileCell>
                </view>
            </a-col>
        </a-row>

    </view>
</template>
<script setup>
import FileCell from '@/custom/pms/components/FileCell'
import Vditor from 'vditor'
import 'vditor/dist/index.css'
import useAppStore from '@/store/modules/app'
const appStore = useAppStore();
import { queryOne } from '@/module/cms/api/article';
const route = useRoute();
const files = ref([])
// 下载文件
function downloadFile(fileId) {

window.location.href = '/dev-api/ufs/download/' + fileId 
}
queryOne(route.params.id).then(res => {
    files.value = res.fileIdList;
    let markdown = res.content;
    Vditor.preview(document.getElementById('preview'),
        markdown, {
        speech: {
            enable: true,
        },
        anchor: 1,
        after() {

        }
    })
})
</script>